<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>elasticsearch-setup-passwords | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'setup-passwords.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/setup-passwords.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/setup-passwords.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/setup-passwords.html" rel="nofollow" target="_blank">../en/setup-passwords.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="commands.html">Command line tools</a></span>
»
<span class="breadcrumb-node">elasticsearch-setup-passwords</span>
</div>
<div class="navheader">
<span class="prev">
<a href="saml-metadata.html">« elasticsearch-saml-metadata</a>
</span>
<span class="next">
<a href="shard-tool.html">elasticsearch-shard »</a>
</span>
</div>
<div class="chapter xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="setup-passwords"></a>elasticsearch-setup-passwords<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/setup-passwords.asciidoc">edit</a><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a>
</h2>
</div></div></div>
<p>The <code class="literal">elasticsearch-setup-passwords</code> command sets the passwords for the
<a class="xref" href="built-in-users.html" title="Built-in users">built-in users</a>.</p>
<h3>
<a id="_synopsis_7"></a>Synopsis<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/setup-passwords.asciidoc">edit</a>
</h3>
<div class="pre_wrapper lang-shell">
<pre class="programlisting prettyprint lang-shell">bin/elasticsearch-setup-passwords auto|interactive
[-b, --batch] [-h, --help] [-E &lt;KeyValuePair&gt;]
[-s, --silent] [-u, --url "&lt;URL&gt;"] [-v, --verbose]</pre>
</div>
<h3>
<a id="_description_7"></a>Description<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/setup-passwords.asciidoc">edit</a>
</h3>
<p>This command is intended for use only during the initial configuration of the
Elasticsearch security features. It uses the
<a class="xref" href="built-in-users.html#bootstrap-elastic-passwords" title="The Elastic bootstrap password"><code class="literal">elastic</code> bootstrap password</a>
to run user management API requests. If your Elasticsearch keystore is password protected,
before you can set the passwords for the built-in users, you must enter the keystore password.
After you set a password for the <code class="literal">elastic</code>
user, the bootstrap password is no longer active and you cannot use this command.
Instead, you can change passwords by using the <span class="strong strong"><strong>Management &gt; Users</strong></span> UI in Kibana
or the <a class="xref" href="security-api-change-password.html" title="Change passwords API">Change Password API</a>.</p>
<p>This command uses an HTTP connection to connect to the cluster and run the user
management requests. If your cluster uses TLS/SSL on the HTTP layer, the command
automatically attempts to establish the connection by using the HTTPS protocol.
It configures the connection by using the <code class="literal">xpack.security.http.ssl</code> settings in
the <code class="literal">elasticsearch.yml</code> file. If you do not use the default config directory
location, ensure that the <span class="strong strong"><strong>ES_PATH_CONF</strong></span> environment variable returns the
correct path before you run the <code class="literal">elasticsearch-setup-passwords</code> command. You can
override settings in your <code class="literal">elasticsearch.yml</code> file by using the <code class="literal">-E</code> command
option. For more information about debugging connection failures, see
<a class="xref" href="trb-security-setup.html" title="Setup-passwords command fails due to connection failure">Setup-passwords command fails due to connection failure</a>.</p>
<h3>
<a id="_parameters_11"></a>Parameters<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/setup-passwords.asciidoc">edit</a>
</h3>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">auto</code>
</span>
</dt>
<dd>
Outputs randomly-generated passwords to the console.
</dd>
<dt>
<span class="term">
<code class="literal">-b, --batch</code>
</span>
</dt>
<dd>
If enabled, runs the change password process without prompting the
user.
</dd>
<dt>
<span class="term">
<code class="literal">-E &lt;KeyValuePair&gt;</code>
</span>
</dt>
<dd>
Configures a standard Elasticsearch or X-Pack setting.
</dd>
<dt>
<span class="term">
<code class="literal">-h, --help</code>
</span>
</dt>
<dd>
Shows help information.
</dd>
<dt>
<span class="term">
<code class="literal">interactive</code>
</span>
</dt>
<dd>
Prompts you to manually enter passwords.
</dd>
<dt>
<span class="term">
<code class="literal">-s, --silent</code>
</span>
</dt>
<dd>
Shows minimal output.
</dd>
<dt>
<span class="term">
<code class="literal">-u, --url "&lt;URL&gt;"</code>
</span>
</dt>
<dd>
Specifies the URL that the tool uses to submit the user management API
requests. The default value is determined from the settings in your
<code class="literal">elasticsearch.yml</code> file. If <code class="literal">xpack.security.http.ssl.enabled</code>  is set to <code class="literal">true</code>,
you must specify an HTTPS URL.
</dd>
<dt>
<span class="term">
<code class="literal">-v, --verbose</code>
</span>
</dt>
<dd>
Shows verbose output.
</dd>
</dl>
</div>
<h3>
<a id="_examples_10"></a>Examples<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/commands/setup-passwords.asciidoc">edit</a>
</h3>
<p>The following example uses the <code class="literal">-u</code> parameter to tell the tool where to submit
its user management API requests:</p>
<div class="pre_wrapper lang-shell">
<pre class="programlisting prettyprint lang-shell">bin/elasticsearch-setup-passwords auto -u "http://localhost:9201"</pre>
</div>
</div>
<div class="navfooter">
<span class="prev">
<a href="saml-metadata.html">« elasticsearch-saml-metadata</a>
</span>
<span class="next">
<a href="shard-tool.html">elasticsearch-shard »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>